#ifndef _DSWONVIF_CLIENT_EX_H
#define _DSWONVIF_CLIENT_EX_H
#include <libbase/dswbase.h>

class CDswonvif_client_ex : public CDswbase
{
public:
	CDswonvif_client_ex(LPST_ENV_T pEnv);
	virtual ~CDswonvif_client_ex();
private:
	static void* cbDescoverThreadFunc(void* pParam){((CDswonvif_client_ex*)pParam)->DescoverThreadFunc();return NULL;};
	void DescoverThreadFunc();
	static void* cbOnvifWorkingThreadFunc(void* pParam){((CDswonvif_client_ex*)pParam)->OnvifWorkingThreadFunc();return NULL;};
	void OnvifWorkingThreadFunc();
private:
	bool OffLineCheck(LPST_EXTERNAL_CAM_EX_T pExtCam);
	void OnvifPrepare();
	void AnsyTime(LPST_EXTERNAL_CAM_EX_T pExtcam);
	bool GetCamTime(LPST_EXTERNAL_CAM_EX_T pExtcam, time_t &nTime);
	void SetCamTime(LPST_EXTERNAL_CAM_EX_T pExtcam, time_t nTime);
	bool GetProfiles(void* psoap, LPST_EXTERNAL_CAM_EX_T pExtcam, char* pMediaURL);
	bool SetStreamGOV(void* psoap, LPST_EXTERNAL_CAM_EX_T pExtcam, char* pMediaURL, struct tt__VideoEncoderConfiguration*  Configuration);
	bool GetStreamURL(void* psoap, LPST_EXTERNAL_CAM_EX_T pExtcam, char* pMediaURL, char* profile_token, char* pStreamURL);

	LPST_ASYNCHRONOUS_CMD_T GetCmdNode(LPLIST_ASYNCHRONOUS_CMD_T pList);
	void PutCmdNode(LPLIST_ASYNCHRONOUS_CMD_T pList, LPST_ASYNCHRONOUS_CMD_T pNode);
	void ProcessAsynCmd();
	void ProcessPTZAction(LPST_ASYNCHRONOUS_CMD_T pCmd);
private:
	virtual int OnMessage(EN_MSG_TYPE nMsgType, void * pParam);
private:
	ST_EXTCAM_TAB_T m_nExtcamTab;
	pthread_t m_nThread_Descover, m_nThread_OnvifWorking;
	ST_ETH_PARAM_T m_nEthParam;
	ST_ASYNC_CMD_T m_nAsyncCmd;
};

#endif

